package thirdquestion;

import java.util.Objects;

public class Employee {
    private int sno;
    private String name;
    private int age;
    private int salary;


    public Employee() {
    }

    public Employee(int sno, String name, int age, int salary) {
        this.sno = sno;
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    public int getSno() {
        return sno;
    }

    public void setSno(int sno) {
        this.sno = sno;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }
    public void work(){
        System.out.println(name+"工作方法");
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return sno == employee.sno &&
                Objects.equals(name, employee.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(sno, name);
    }
}
